<?php


namespace app\manage\controller;


use app\common\model\UserRoles;

class Clerk extends Base
{
    public function where()
    {
        $type = $type = $this->UserType();
        $where = [
            ["type","eq",2]
        ];
        if ($type == 1){
            $stores_id = $this->stores_id();
            $where[] = [
                ["stores_id","eq",$stores_id]
            ];
        }
        return $where;
    }

    public function getModel()
    {
        return (new \app\common\model\Users());
    }
    public function addAttach($info)
    {
        $userid     = session('userid', '', session_prefix());
        $type = $this->UserType();
        $roles = UserRoles::field('id,name')->order('id ASC')->select();
        $stores = \app\common\model\Stores::field('id,name')->order('id ASC')->select();
        $stores_id = $this->stores_id();
        $this->assign('roles', $roles);
        $this->assign('stores', $stores);
        $this->assign('user_id', $userid);
        $this->assign('type', $type);
        $this->assign('stores_id', $stores_id);
    }
}